home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / INFO / DOSTIPS4.ZIP / DOSBOOT.TXT < prev    next >
Text File  |  1986-06-28  |  15KB  |  319 lines

  1.                        Sneaky Boot Tricks
  2.        (PC Magazine Vol 5 No 4 Feb 25, 1986 User-to-User)
  3.  
  4.      The technique for patching COMMAND.COM to execute a file other
  5. than AUTOEXEC.BAT on boot-up was discussed in Vol 4 No 24 User-to-User.
  6. You can give this trick a twist by dropping the .BAT extension.  This
  7. way, COMMAND.COM will execute the boot batch file only on boot-up.
  8. Attempts to run the file a second time will resulte in the "Bad command
  9. or filename" message.  This is ideal for using those programs that stay
  10. resident but crash the system if you run them twice.
  11.      Put the run-once-only programs in a hidden directory.  You can
  12. access a directory using CD or CHDIR although it is hidden from normal
  13. display using DIR or TREE.  For DOS 2.x, patch a copy of COMMAND.COM
  14. with DEBUG as follows:
  15.  
  16. A>DEBUG COMMAND.COM
  17. -E 1078 "ONCE    "
  18. -W
  19. -Q
  20.  
  21. The added blanks are to erase the string "AUTOEXEC.BAT completely.
  22.      Then create a file named ONCE (but without the .BAT extension)
  23. containing your initialization programs or whatever in the usual batch
  24. file format.  You might even make the last entry a branch to an
  25. AUTOEXEC.BAT file to mislead the uninformed.  At this point it is
  26. unlikely a casual user will spot your secrets.
  27.      While patches of this sort are usually done with DEBUG, the Norton
  28. Utilities Sector Modify (SM.COM) program, or equivalent program, PC-
  29. Write by Quicksoft is quite capable of editing machine code files.  PC-
  30. Write searches through the machine code rubbish to find specified ASCII
  31. strings with astonishing speed.  If care is taken to use the overwrite
  32. mode, the altered program will run normally (except, of course, for
  33. your change).  PC-Write can also be used to customize program logos
  34. and rewrite menu screens and help and message overlays.
  35.      Patching may also be possible with other editors that use the
  36. declared file length rather than an end-of-file mark and allow the use
  37. of the full 256-character IBM character set.
  38.      Editor's Note:  It's true that COMMAND.COM will run both an
  39. AUTOEXEC program that lacks a BAT extension, as well as normal BAT,
  40. COM or EXE programs in hidden subdirectories.  The best way to execute
  41. this trick is to change the AUTOEXEC.BAT reference in COMMAND.COM so
  42. it reflects the hidden path.
  43.      The following technique is for floppies only -- playing with your
  44. hard disk directory in DEBUG can be very dangerous.  In fact, be sure
  45. to type everything exactly as shown -- if you read a directory off a
  46. floppy disk and write it back to a hard disk, well, that's what backups
  47. are for.  And these instructions are also expressly for DOS 3.1,
  48. although the same fundamental technique will work for other versions.
  49.      First, put a blank floppy into drive B: and format it with the /S
  50. option.  Next, create a subdirectory on this floppy called simply \A
  51. (by typing MD\A).  Then, with this floppy still in drive B:, get into
  52. 3.1 DEBUG (if you don't have a hard disk with DEBUG already PATHed to,
  53. put a disk with DEBUG on it in drive A: and type A:DEBUG), and at the
  54. DEBUG prompt, type:  -L 100 1 5 5  to load the beginning of the
  55. directory on drive B:.  This is very important -- DEBUG refers to
  56. drive A: as 0, drive B: as 1, drive C: as 2, etc.  Be very careful in
  57. using DEBUG to write to a disk.  Avoid writing to drive 2, which is
  58. drive C:.
  59.      To hide the \A subdirectory (or any unhidden file), all you have
  60. to do is add 2 to the value of the 12th byte (which is actually byte
  61. 11, since the first byte is byte 0).  Since subdirectory names are
  62. really just files, the \A subdirectory will be the fourth file on your
  63. disk (after IBMBIO.COM, IBMDOS.COM and COMMAND.COM).  Type D to see all
  64. four directory entries.
  65.      The listing for \A will begin at address 160.  Byte 11 (which is
  66. really the 12th byte) has a value of &H10.  Adding 2 to it yields a
  67. value of &H12.  So to hide the subdirectory, at the prompt, type:
  68. -E 16B 12.  Then write the new directory back to disk by typing:
  69. -W 100 1 5 5.  (This is exactly what you typed to load the directory,
  70. except that the L is replaced by a W.)  You'll find the \A subdirectory
  71. is invisible to such DOS commands as DIR and TREE (but not to CHKDSK
  72. /V or CD).  When finished, type Q to quit DEBUG.
  73.     Once you've hidden the subdirectory, you have to change COMMAND.COM
  74. so it knows where to look for your boot file.  Since AUTOEXEC.BAT takes
  75. up 12 characters, there's plenty of room for both a path and a secret
  76. filename for your boot program.  Call the AUTOEXEC.BAT substitute
  77. program \A\SECRET.  In DOS 3.1, \AUTOEXEC.BAT begins at address 130E,
  78. but since the hidden subdirectory is called \A, leave the first two
  79. characters "\A" alone.  The remaining UTOEXEC.BAT begins at address
  80. 1310, so change that to \SECRET by typing:  -E 1310 "\SECRET    "
  81. followed by the usual W to write the file and Q to quit.  Note there
  82. are four spaces at the end to pad out the unused characters, since
  83. \SECRET is shorter than UTOEXEC.BAT.  Then copy the normal AUTOEXEC.BAT
  84. routine to b:\A\SECRET, and you're all set.  Obviously, if you want to
  85. do this right, you'll use a name other than SECRET, which would provoke
  86. unnecessary curiosity.
  87.  
  88. -----------------------------------------------------------------
  89.                         Accelerating 2.1
  90.  
  91.      The information contained below is courtesy of PC Tech Journal
  92. March 1986 by Robin Rodabaugh.
  93.  
  94.      Different versions of DOS have different values for head settle
  95. time.  After seeking from one track to another, diskette drive heads
  96. tend to oscillate before they stabilize enough to be able to read or
  97. write data.
  98.      In DOS 1.0, the head settle time default is 25 milliseconds.  For
  99. DOS 1.1 and 2.0, this default is corrected to 0, which is one reason
  100. that these later versions run faster than 1.0.  Upon introducing half-
  101. height drive support in DOS 2.1, this default inflated to 15 m-seconds.
  102.      The patches presented below can reduce head settle time in 2.1
  103. The FORMAT feature exhibits the most noticeable difference.  A FORMAT
  104. of a double-sided, nin-sector diskette normally runs 65 seconds under
  105. DOS 2.1, but with the patches it takes 41 seconds.
  106.      Tests on PCjr and PC Portable show no problems using the faster
  107. parameters (the reason given for the increase in head settle time in
  108. DOS 2.1 was to accomodate the half-height drives of PCjr and the
  109. Portable).
  110.  
  111.      To customize DOS 2.1 so it will run at the speed of versions 1.1
  112. and 2.0, the reset diskette default parameters must be modified.  They
  113. are contained in four locations: one in the bootstrap, two in the
  114. hidden file IBMBIO.COM, and one in the FORMAT command.  The bootstrap
  115. parameters are in control momentarily at boot time.  The IBMBIO.COM
  116. parameters are in control most of the time.  The FORMAT.COM parameters
  117. are simply placed in the bootstrap of diskettes that are formatted;
  118. changing FORMAT.COM is a convenient way to implement the faster
  119. parameters for all diskettes to be formatted in the future, without
  120. having to run DEBUG for each one.
  121.      With the patches, all disks formatted from the customized diskette
  122. or hard disk will have the faster parameters.  A hard disk must have a
  123. single partition.  All disk drives have a finite head settle time.  The
  124. implementation of these modifications may cause data to be sent to the
  125. disk drive before the drive is ready.  Most applications successfully
  126. perform a retry not visible to the user.  The critical value for the
  127. head settle time is 0.  Changes up to 65 m-seconds do not significantly
  128. alter the time required to format a diskette.
  129.      To accomplish the customization, insert a double-sided boot
  130. diskette in drive A: or a hard disk in drive C:.  Use DEBUG to change
  131. the head settle time defaults, as shown below.  (Comments are shown
  132. in parentheses.)
  133.      These same modifications cannot be made with DOS 3.1 as the
  134. bootstrap, because IBMBIO.COM and FORMAT.COM do not have the same
  135. string of instructions that reset the diskette default parameters.
  136.  
  137. For Bootstrap:
  138.  
  139. A>DEBUG
  140. -L 100 0 0 1  (Read in bootstrap)
  141.               (If patching a hard disk, use "L 100 2 0 1")
  142. -D 100        (Confirm that location 12A contains 0F02CD18H)
  143. -E 12A 00     (Change 15 milliseconds to zero)
  144. -D 100        (Confirm that location 12A contains 00H)
  145. -W 100 0 0 1  (Write out the modified bootstrap)
  146.               (If patching a hard disk, use "W 100 2 0 1")
  147. -Q            (Exit DEBUG)
  148.  
  149.  
  150. For IBMBIO.COM:
  151.  
  152. A>DEBUG
  153. -L 100 0 F 1  (Read in sector 4 of IBMBIO.COM)
  154.               (If patching a hard disk, use "L 100 2 34 1")
  155. -D 100        (Confirm that location 177 contains 0F9C1E50H)
  156. -E 177 00     (Change 15 milliseconds to zero)
  157. -D 100        (Confirm that location 177 contains 00H)
  158. -W 100 0 F 1  (Write out sector 4 of IBMBIO.COM)
  159.               (If patching a hard disk, use "W 100 2 34 1")
  160. -L 100 0 10 1 (Read in sector 5 of IBMBIO.COM)
  161.               (If patching a hard disk, use "L 100 2 35 1")
  162. -D 100        (Confirm that location 154 contains 0FABB002H)
  163. -E 154 00     (Change 15 milliseconds to zero)
  164. -D 100        (Confirm that location 154 contains 00H)
  165. -W 100 0 10 1 (Write out sector 5 of IBMBIO.COM)
  166.               (If patching a hard disk, use "W 100 2 35 1")
  167. -Q            (Quit DEBUG)
  168.  
  169.  
  170. For FORMAT.COM:
  171.  
  172. A>DEBUG
  173. -N FORMAT.COM   (Name FORMAT.COM as the target file)
  174. -L              (Read in FORMAT.COM)
  175. -D 1A00         (Confirm that location 1A22 contains 0F02CD19H)
  176. -E 1A22 00      (Change 15 milliseconds to zero)
  177. -D 1A00         (Confirm that location 1A22 contains 00H)
  178. -W              (Write out the modified FORMAT.COM)
  179. -Q              (Quit DEBUG)
  180.  
  181. -----------------------------------------------------------------
  182.                           Fast Reboots
  183.        (PC Magazine Vol 5 No 7 Apr 15, 1986 User-to-User)
  184.  
  185.      An previous submission suggested a complicated method to reboot
  186. a system that redirected a text script through DEBUG.  This method
  187. required two files and numerous disk accesses that are not necessary.
  188. The exact same procedure can be accomplished with a short .COM file.
  189. Use DEBUG to create a file, called REBOOT.COM:
  190.  
  191. A>debug
  192. -n reboot.com
  193. -rcx
  194. -5
  195. -e 100 ea f0 ff 00 f0
  196. -w
  197. -q
  198.  
  199. You can then reboot at any time in DOS simply by typing REBOOT.
  200.      Editor's Note:  This short program simply jumps to the reboot
  201. routine stored in ROM BIOS (at address F000:FFF0).  There's an even
  202. more efficient way to reboot a system by using BIOS Interrupt 19.
  203. Use DEBUG and type:
  204.  
  205. A>debug
  206. -n reboot.com
  207. -rcx
  208. -2
  209. -e 100 cd 19
  210. -w
  211. -q
  212.  
  213. (This won't work if SideKick is loaded.)  You can adapt this 2-byte
  214. program to jump to BASIC by using Interrupt 18 rather than 19.  Simply
  215. change the second line of the above to:
  216.  
  217. -n gobasic.com
  218.  
  219. Then change the third line from the end to:
  220.  
  221. -e 100 cd 18
  222.  
  223. After you create this file, typing GOBASIC will jump to Cassette BASIC.
  224. This can be used as a primitive security measure.
  225.  
  226. -----------------------------------------------------------------
  227.                        Custom Boot Records
  228.        (PC Magazine Vol 5 No 9 May 13, 1986 User-to-User)
  229.  
  230.      There are two ways to use DEBUG to customize boot records.  The
  231. first is to patch FORMAT.COM, which writes the boot message to disks
  232. that it formats.  Get into DOS and type:
  233.  
  234. DEBUG FORMAT.COM
  235. E YYYY "Put DOS system diskette in Drive A:" D A
  236. E ZZZZ "Press any key to start DOS ...."
  237. W
  238. Q
  239.  
  240. substituting the message addresses for the YYYY and ZZZZ as follows:
  241.  
  242. DOS 2.1 -- YYYY=1915  ZZZZ=193A
  243. DOS 3.1 -- YYYY=2498  ZZZZ=24BD
  244.  
  245. The new message will then appear on every disk formatted with this
  246. customized version of FORMAT.COM
  247.  
  248.      You can also patch the boot record directly.  Get into DOS and
  249. type:
  250.  
  251. DEBUG
  252. L 0 N 0 1
  253. E YYY "Put the DOS system diskette in Drive A:" D A
  254. E ZZZ "Press any key to start DOS ...."
  255. W 0 N 0 1
  256. Q
  257.  
  258. substituting the message addresses for the YYY and ZZZ as follows:
  259.  
  260. DOS 2.1 -- YYY=182    ZZZ=1A7
  261. DOS 3.1 -- YYY=161    ZZZ=186
  262.  
  263. and substituting the number of the drive for the N as follows:
  264.  
  265. N=0 for drive A:
  266. N=1 for drive B:
  267. N=2 for drive C:
  268. N=3 for drive D:
  269.  
  270.      Editor's Note:  These two techniques are valuable for expert users
  271. who are preparing disks for less expert users.  FORMAT.COM writes the
  272. same confusing "Non-system disk or disk error/Replace and strike any
  273. key when ready" message to every diskette, even those formatted with
  274. the /S option.  It's better to substitute your own friendly message.
  275.  
  276.      Changing FORMAT.COM probably makes more sense, since you can make
  277. one patch and have the new boot record written to every diskette you
  278. format afterward.  However, customizing individual boot records can be
  279. useful when you want to add a special message for a particular user.
  280.      And patching a program like FORMAT.COM is far safer than playing
  281. with a boot record where you're writing to an absolute sector,
  282. especially on hard disk systems.  When you use DEBUG's W(rite) command,
  283. you specify the target drive somewhat counter-intuitively:  A is 0,
  284. not 1; B is 1, not 2, etc.  If you're not careful, you may thing you're
  285. writing to drive B: by specifying a 2, when 2 actually tells DEBUG to
  286. write to your hard disk C: with potentially horrendous results.
  287.      This method uses DEBUG to L(oad) the contents of sector 0 into
  288. memory address 0.  Most DEBUG users are accustomed to loading programs
  289. at address &H100.  Both ways work but if you do load the information
  290. at 100 instead of 0, add 100 to the DEBUG YYY and ZZZ addresses (so
  291. 161 becomes 261, etc.).  Make sure that all the sector and address
  292. information following the L and W commands is identical.  And if
  293. you're not very familiar with the process, it's a good idea when
  294. patching something like a boot record to use the D(ump) command to
  295. make sure you're in the right place.  After entering DEBUG, load the
  296. information (and watch the drive lights to make sure you're reading
  297. the proper disk) and then hit D a few times to make sure you're in
  298. the area with the "Non-system disk ..." messages.  If you're not,
  299. immediately hit Q and then the Enter key to quit and start again.
  300.      It's easy to find the location of such messages for other versions
  301. of DOS.  If you're patching FORMAT.COM, after typing DEBUG FORMAT.COM,
  302. type RCX to find out low long the file is (then just hit the Enter key
  303. to return to the DEBUG hyphen prompt).  Add 100 to the hex number
  304. printed on the screen, and then substitute it for the XXXX below and
  305. type:
  306.  
  307. S 100 XXXX "Non-system disk"
  308.  
  309. to S(earch) for every occurrence of "Non-system disk" in the file.
  310. DEBUG will print out the starting address for each piece of identical
  311. text it finds.  If it finds several addresses, you can use the D
  312. command followed by these addresses to examine which one(s) you want
  313. to change.
  314.      Finally, remember that your new message can't be longer than the
  315. original one.  If it's shorter, be sure to pad it out with blank
  316. spaces before the final quotation mark to overwrite the old text
  317. completely.
  318.  
  319.